package com.example.demo.entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity
@Table(name="customer") //这个@Table注解可以不写，会默认将表名命名为Customer即类名，若使用Table注解，可以在里面定义表名
public class Customer {
	
	@Id//这些注解一定要写在对应属性变量定义上面，不要写在get方法上面（气死我了，这个跟idea里面不一样，因为这个导致报错，浪费了一天的时间  烦人）
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	protected int id;//顾客ID
	
	@Basic//这是一个默认注解，entity下面的属性，若未写@Column注解，则会默认使用@Basic注解，此处可以不写@Basic
	protected String name;//顾客姓名
	
	@Column(name="nick_name",nullable = false,length = 11)//nullable 设置是否为空，length设置字段长度
	protected String nickname;//顾客的昵称
	
	protected String age;//年龄
	
	protected String sex;//性别
	
	@Column(name = "password",nullable = false)
	protected String password;//密码
	
	@Column(length = 20, nullable=false)
	protected String phone;//电话
	

	protected float deposit;//余额

	public int getId() {
		return id;
	}


	public void setId(int id) {
		this.id = id;
	}


	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getAge() {
		return age;
	}

	public void setAge(String age) {
		this.age = age;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}


	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}


	public float getDeposit() {
		return deposit;
	}

	public void setDeposit(float deposit) {
		this.deposit = deposit;
	}

	@Override
	public String toString() {
		return "Customer [id=" + id + ", name=" + name + ", nickname=" + nickname + ", age=" + age + ", sex=" + sex
				+ ", password=" + password + ", phone=" + phone + ", deposit=" + deposit + "]";
	}
	
	

}
